{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "e34e9cd7-d42d-47a5-a67a-cee33c107841",
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": [
    "import numpy as np\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "ab597f1e-2878-4433-ba11-ab86ea1ce006",
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "fdfb463c-d8df-4b3f-b14c-342bfa14b5e0",
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 1,  2,  3,  4,  5,  6,  7,  8,  9, 10])"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a = np.arange(1,11)\n",
    "a"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "0894dd8b-7422-4db2-ba5d-32a100400eed",
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[10  9  8  7  6  5  4  3  2  1]\n"
     ]
    }
   ],
   "source": [
    "print(a[-1::-1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "fe4fa1b4-8a57-4d79-bd6c-6322241b6031",
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,\n",
       "       1., 1., 1.])"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a = np.ones(20)\n",
    "a"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "95b35a2a-acb8-4ec2-8698-670f8d174e47",
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[1., 1., 1., 1., 1.],\n",
       "       [1., 1., 1., 1., 1.],\n",
       "       [1., 1., 1., 1., 1.],\n",
       "       [1., 1., 1., 1., 1.]])"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "b=a.reshape(4,5)\n",
    "b"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "999b4606-9a10-4264-8f58-6200bd21ebfa",
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[1., 1., 1., 1.],\n",
       "       [1., 1., 1., 1.],\n",
       "       [1., 1., 1., 1.],\n",
       "       [1., 1., 1., 1.],\n",
       "       [1., 1., 1., 1.]])"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "b.T"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "582876d0-cf7d-441a-9429-37331a40cf90",
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[[2, 8, 8],\n",
       "        [8, 5, 7],\n",
       "        [1, 6, 5]],\n",
       "\n",
       "       [[0, 2, 4],\n",
       "        [9, 7, 1],\n",
       "        [7, 4, 0]],\n",
       "\n",
       "       [[2, 0, 5],\n",
       "        [0, 3, 0],\n",
       "        [4, 1, 1]]])"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.random.randint(0,10,size = [3,3,3])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "id": "064a4b16-8062-4b02-a540-f5fd36878a53",
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[1 9 1 8 7 4 7 9 4 5]\n",
      "[1 1 4 4 5 7 7 8 9 9]\n",
      "9\n",
      "1\n",
      "55\n",
      "8.05\n"
     ]
    }
   ],
   "source": [
    "a=np.random.randint(1,10,10)\n",
    "print (a)\n",
    "print(np.sort(a))\n",
    "print(np.max(a))\n",
    "print(min(a))\n",
    "print(a.sum())\n",
    "print(np.var(a))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "id": "34209002-f400-445b-80c3-823eabf095e8",
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([3, 6, 6, 1, 1, 4, 3, 2, 1, 1])"
      ]
     },
     "execution_count": 41,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a = np.random.randint(1,10,10)\n",
    "a"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "id": "4d1b0d58-a93a-4aee-b78a-4c7f28313d88",
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([3, 1, 1, 3, 1, 1])"
      ]
     },
     "execution_count": 42,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a[a%2==1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "id": "1f2c345d-645e-45b7-a97c-cb3e48b9f589",
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 0.,  5., 10., 15., 20., 25., 30., 35., 40., 45., 50., 55., 60.,\n",
       "       65., 70., 75., 80., 85., 90., 95.])"
      ]
     },
     "execution_count": 47,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a = np.arange(0,100,5)\n",
    "a.astype(float)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "id": "210658ac-b492-4dba-a781-730ee8937040",
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([5, 5, 2, 6, 3, 8, 7, 5, 6, 5])"
      ]
     },
     "execution_count": 57,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a = np.random.randint(1,10,10)\n",
    "a"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "id": "8d18e46a-83ba-4f48-a23f-2448fb824015",
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([-5, -5,  2, -6,  3,  8, -7, -5, -6, -5])"
      ]
     },
     "execution_count": 58,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a[(a>3)&(a<8)]*=-1\n",
    "a\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "id": "92b097aa-86fb-43ba-af42-f6abe0adfcba",
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([1, 0, 2, 0, 3, 0, 4, 0, 5])"
      ]
     },
     "execution_count": 62,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a = np.arange(1,6)\n",
    "b= np.zeros(4,dtype = int)\n",
    "np.insert(a,a[:-1:],0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 67,
   "id": "71e51137-a1fb-4ea0-a581-b747f167d670",
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[9, 6, 7, 6, 9],\n",
       "       [3, 4, 8, 5, 8],\n",
       "       [5, 7, 7, 9, 8],\n",
       "       [5, 9, 1, 3, 3],\n",
       "       [9, 4, 9, 1, 3]])"
      ]
     },
     "execution_count": 67,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a = np.random.randint(1,10,size = (5,5))\n",
    "a"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 69,
   "id": "a42518f5-fd61-4f62-8390-5297ad212091",
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[3, 4, 8, 5, 8],\n",
       "       [9, 6, 7, 6, 9],\n",
       "       [5, 7, 7, 9, 8],\n",
       "       [5, 9, 1, 3, 3],\n",
       "       [9, 4, 9, 1, 3]])"
      ]
     },
     "execution_count": 69,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "b =a.copy()\n",
    "first_line=b[0,:]\n",
    "second_line=b[1,:]\n",
    "a[0,:]= second_line\n",
    "a[1,:]=first_line\n",
    "a"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "a770a408-37e6-4260-961c-755eb58a599f",
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}